﻿using UnityEngine;

class HelpTool
{
    public static float LerpValue(float a, float b, float t)
    {
        if (t <= 0)
            return a;
        else if (t >= 1)
            return b;
        return a + (b - a) * t;
    }

    public static float FrameToTime(int frame, float frameRate)
    {
        return frame / frameRate;
    }

    public static int TimeToFrame(float time, float frameRate)
    {
        return Mathf.RoundToInt(time * frameRate);
    }

    public static Vector3 CrossVector(Vector3 a, Vector3 b, float time, float crossTime)
    {
        return Vector3.Lerp(a, b, time / crossTime);
    }

}

